import operate from '@dfeidao/atom-nodejs/db/operate';
// import { systemid } from './config';

interface Message {
	id: string;
	productid: string;
}

export default async function atom(msg: Message, action_id: string, session_id: string) {
	const systemid = '12';
	const { del, exec } = operate(action_id, session_id, systemid);
	// const { exec, prepare } = del(action_id, session_id, spaceid, systemid);
	del('pub_role_type', { _id: msg.id, productid: msg.productid });
	// const ret = await exec();
	del('pub_role_fields', { role_type_id: msg.id, productid: msg.productid });
	// const ret1 = await exec();
	del('pub_role_sysparams', { role_type_id: msg.id, productid: msg.productid });
	const ret2 = await exec();
	if (ret2.code === 1) {
		return 'success';
	} else {
		return 'fail';
	}
}
